<?php

namespace app\admin\validate;

use think\Validate;

/**
 * 工作记录每日数据信息验证器
 * Created by PhpStorm.
 * User: tyll
 * Date: 2019/11/21
 * Time: 16:48
 */
class WorkRecordData extends Validate
{
    protected $rule = [
        'department'                     => 'require',
        'today_shop_person_num'          => 'require|integer|egt:0',
        'front_money'                    => 'require|float|regex:/^\d+(\.\d{0,2})?$/|egt:0',
        'vip_back_money'                 => 'require|float|regex:/^\d+(\.\d{0,2})?$/|egt:0',
        'check_in_back_money'            => 'require|float|regex:/^\d+(\.\d{0,2})?$/|egt:0',
        'agency_back_money'              => 'require|float|regex:/^\d+(\.\d{0,2})?$/|egt:0',
        'account_back_money'             => 'require|float|regex:/^\d+(\.\d{0,2})?$/|egt:0',
        'trademark_back_money'           => 'require|float|regex:/^\d+(\.\d{0,2})?$/|egt:0',
        'science_money'                  => 'require|float|regex:/^\d+(\.\d{0,2})?$/|egt:0',
        'other_money'                    => 'require|float|regex:/^\d+(\.\d{0,2})?$/|egt:0',
        'now_money'                      => 'require|float|regex:/^\d+(\.\d{0,2})?$/|egt:0',
        'today_total_money'              => 'require|float|regex:/^\d+(\.\d{0,2})?$/|egt:0',
        'pic'                            => 'require'
    ];

    protected $message = [
        'department.require'               => '部门必须填写',

        'today_shop_person_num.require'    => '今日到店客户数必须填写',
        'today_shop_person_num.integer'    => '今日到店客户数填写错误',
        'today_shop_person_num.egt'        => '今日到店客户数填写错误',

        'front_money.require'              => '定金必须填写',
        'front_money.float'                => '定金填写错误',
        'front_money.regex'                => '定金只能两位小数',
        'front_money.egt'                  => '定金填写错误',

        'vip_back_money.require'           => '会员回款必须填写',
        'vip_back_money.float'             => '会员回款填写错误',
        'vip_back_money.regex'             => '会员回款只能两位小数',
        'vip_back_money.egt'               => '会员回款填写错误',

        'check_in_back_money.require'      => '入住回款必须填写',
        'check_in_back_money.float'        => '入住回款填写错误',
        'check_in_back_money.regex'        => '入住回款只能两位小数',
        'check_in_back_money.egt'          => '入住回款填写错误',

        'agency_back_money.require'        => '代办回款必须填写',
        'agency_back_money.float'          => '代办回款填写错误',
        'agency_back_money.regex'          => '代办回款只能两位小数',
        'agency_back_money.egt'            => '代办回款填写错误',

        'account_back_money.require'       => '代账回款必须填写',
        'account_back_money.float'         => '代账回款填写错误',
        'account_back_money.regex'         => '代账回款只能两位小数',
        'account_back_money.egt'           => '代账回款填写错误',

        'trademark_back_money.require'     => '商标回款必须填写',
        'trademark_back_money.float'       => '商标回款填写错误',
        'trademark_back_money.regex'       => '商标回款只能两位小数',
        'trademark_back_money.egt'         => '商标回款填写错误',

        'science_money.require'            => '科技服务必须填写',
        'science_money.float'              => '科技服务填写错误',
        'science_money.regex'              => '科技服务只能两位小数',
        'science_money.egt'                => '科技服务填写错误',

        'other_money.require'              => '其他必须填写',
        'other_money.float'                => '其他填写错误',
        'other_money.regex'                => '其他只能两位小数',
        'other_money.egt'                  => '其他填写错误',

        'now_money.require'                => '目前金额必须填写',
        'now_money.float'                  => '目前金额填写错误',
        'now_money.regex'                  => '目前金额只能两位小数',
        'now_money.egt'                    => '目前金额填写错误',

        'today_total_money.require'        => '今日总金额必须填写',
        'today_total_money.float'          => '今日总金额填写错误',
        'today_total_money.regex'          => '今日总金额只能两位小数',
        'today_total_money.egt'            => '今日总金额填写错误',

        'pic.require'                      => '图片必须填写'
    ];

    protected $scene = [
        'add'  => ['department', 'today_shop_person_num', 'front_money', 'vip_back_money', 'check_in_back_money', 'agency_back_money', 'account_back_money', 'trademark_back_money', 'science_money', 'other_money', 'now_money', 'today_total_money'],
        'edit' => ['department', 'today_shop_person_num', 'front_money', 'vip_back_money', 'check_in_back_money', 'agency_back_money', 'account_back_money', 'trademark_back_money', 'science_money', 'other_money', 'now_money', 'today_total_money']
    ];
}
